package com.tanhua.dubbo.api.Impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.dubbo.api.BlackListApi;
import com.tanhua.dubbo.api.SettingsApi;
import com.tanhua.dubbo.mappers.BlackListMapper;
import com.tanhua.dubbo.mappers.UserInfoMapper;
import com.tanhua.model.domain.BlackList;
import com.tanhua.model.domain.UserInfo;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class BlackListServiceImpl implements BlackListApi {
    @Autowired
    private UserInfoMapper userInfoMapper;

    @Autowired
    private BlackListMapper blackListMapper;
    @Override
    public IPage<UserInfo> FindByUserId(Long userId, int page, int size) {
        Page pages = new Page(page,size);
        return userInfoMapper.FindByUserId(pages,userId);
    }

    @Override
    public void deleteBlackList(Long blackuid) {
        QueryWrapper<BlackList> wrapper = new QueryWrapper<>();
        wrapper.eq("black_user_id",blackuid);
        blackListMapper.delete(wrapper);
    }


}
